/*
** Copyright (C) 2011 Viens Yann
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef FILTERS_HPP_
# define FILTERS_HPP_

# include <string>
# include <opencv/cv.h>

class		Filters
{
public:
	typedef IplImage* (Filters::*Filter)(IplImage*);
	void		add(std::string const& key, Filter value);
	void		remove(std::string const& key);
	IplImage*	revert(IplImage* input);

	IplImage*	processFilters(IplImage* input);
private:
	std::map<std::string, Filter>		_filters;
	
	struct Processor
	{
	public:
		Processor(Filters* caller, IplImage* input);
		void		operator()(std::pair<const std::string, Filter>& elem);
		Filters*	_caller;
		IplImage*	_output;
	};
};

#endif // !FILTERS_HPP_
